<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" th:href="@{/css/bootstrap.css}"/>
    <link rel="stylesheet" th:href="@{/css/login.css}"/>
    <script type="text/javascript" th:src="@{/js/jquery-3.3.1.js}"></script>
    <script type="text/javascript" th:src="@{/js/bootstrap.js}"></script>
    <title>Login</title>
</head>

<body>
<div id="login">
    <div id="top">
        <img th:src="@{/images/cloud.jpg}" src="#" alt="cloud.jpeg"/><span>LOGIN</span>
    </div>
    <div id="bottom">
        <form th:action="@{/admin/login.action}" action="#" method="post">
            <table id="table" style="border: 0">
                <tr>
                    <td class="td1">用户名：</td>
                    <td>
                        <label>
                            <input type="text" value="" placeholder="Username" class="td2" name="name">
                        </label>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td><span id="nameErr"></span></td>
                </tr>
                <tr>
                    <td class="td1">密码：</td>
                    <td>
                        <label>
                            <input type="password" value="" placeholder="Password" class="td2" name="pwd">
                        </label>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td><span id="pwdErr"></span></td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <input type="submit" value="登录" class="td3">
                        <a th:href="@{/admin/register}">
                            <input type="button" value="注册" class="td3	">
                        </a>
                    </td>
                </tr>
            </table>
        </form>
        <!--/*@thymesVar id="errMsg" type="java.lang.String"*/-->
        <p th:text="${session.errMsg}" id="tip">tip:</p>
    </div>
</div>
</body>
<script>
    $("#name").blur(function () {
        alert('jin')
        if ($('#name').val() === "" || $('#pwd').val() === "") {
            $('#tip').css("color", "red")
        } else {
            $('#tip').hide()
        }
    })

    $("#pwd").blur(function () {
        alert('jin')
        if ($('#name').val() === "" || $('#pwd').val() === "") {
            $('#tip').css("color", "red")
        } else {
            $('#tip').hide()
        }

    })
</script>
</html>